﻿using System;
using System.Threading.Tasks;
using Hopscotch.Presentation.Common.Threading;

namespace Hopscotch.Test.Presentation.Threading
{
    public class SynchronousDispatcher : IDispatcher
    {
        public int ThreadId
        {
            get { return 0; }
        }

        public string ThreadName
        {
            get { return typeof(SynchronousDispatcher).Name; }
        }

        public bool CheckAccess()
        {
            return true;
        }

        public void Invoke(Action method)
        {
            method.Invoke();
        }

        public Task RunAsync(Action method)
        {
            method.Invoke();
            return Task.FromResult(0);
        }

    }
}
